package com.chap12;

import java.util.concurrent.*;

/**
 * <p>
 * <code>ThreadPoolTest</code>
 * </p>
 *
 * @author junbao3
 * TODO
 * @date 2023-04-03 15:22
 * Copyright (C) 2021 IFlyTek. All rights reserved.
 */
public class ThreadPoolTest {
    public static void main(String[] args) {
        ThreadPoolExecutor executor =
                new ThreadPoolExecutor(10,200,1000,
                        TimeUnit.SECONDS,new ArrayBlockingQueue<>(200));
        //往线程池提交任务
        executor.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("...");
            }
        });

        executor.shutdown();

        //调用了shutdown()，再提交任务会报错
        executor.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("...");
            }
        });
    }
}
